@extends('layouts.back_stage')
@section('style')
    @parent
    <link rel="stylesheet" type="text/css" href="/static/css/list.css"/>
@endsection
@section('content')
    <div class="list">
        <div class="list_top">
            <div class="list_tl">
                <input type="text" class="list_inp" />
            </div>
        </div>

        <div class="list_bottom">
            <span class="list_span">信息:</span>
            <div class="list_br">
                <ul class="list_ul">
                    <li class="list_li">
                        <span class="list_tit">款号</span>
                        <p class="list_brand style_num"></p>
                    </li>
                    <li class="list_li">
                        <span class="list_tit">品牌</span>
                        <p class="list_brand list_b"></p>
                    </li>
                    <li class="list_li">
                        <span class="list_tit">类目一</span>
                        <p class="list_brand category_one"></p>
                    </li>
                    <li class="list_li">
                        <span class="list_tit">类目二</span>
                        <p class="list_brand category_two"></p>
                    </li>
                    <li class="list_li">
                        <span class="list_tit">颜色</span>
                        <p class="list_brand color"></p>
                    </li>

                    <li class="list_li">
                        <span class="list_tit">数量(手数)</span>
                        <p class="list_brand num"></p>
                    </li>

                    <li class="list_li">
                        <span class="list_tit">件数(件数)</span>
                        <p class="list_brand total"></p>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="mask" style="display:none;"></div>
    <script>

        //自动获取焦点
        setTimeout(function () {
            $(".list_inp").focus();
        },50);
        $(function(){
            $('.list_inp').blur(function () {
                var that = this;
                setTimeout(function () {
                    $(that).focus();
                },100);
            });
        });
        /*input实时监控*/
        $(".list_inp").on("input",function(){

            var old_list = $('.list_inp').val();
            if(old_list.length != 73){
                return false;
            }
            var list = old_list.substr(-39,32);
            $('.list_inp').val('');
            if (list != '') {
                $.ajax({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                    },
                    type: 'post',
                    url: '/dealer/qualityTest',
                    data: {'code':list},
                    dataType:'json',
                    success: function (data) {
                        if(data.msg=='1') {
                            var arr1=data.info.pro_datas;
                            $('.style_num').text(arr1.item);
                            $('.list_b').text(arr1.brand_name);
                            $('.category_one').text(arr1.category_one_name);
                            $('.category_two').text(arr1.category_two_name);
                            $('.color').text(arr1.color);
                            $('.num').text(arr1.num);
                            $('.total').text(arr1.total);
                        }
                        $('.list_inp').val('');

                    }
                })

            }


        })
    </script>
@endsection